package com.xubao.ali.services;

import java.util.List;

import org.njbdqn.ali.database.PageHelper;

import com.xubao.ali.dao.ChaptersDAO;
import com.xubao.ali.entity.Chapters;
import com.xubao.ali.vo.chapter.Catalog;
import com.xubao.ali.vo.chapter.Text;

public class ChaptersService {
	private ChaptersDAO cdao;
	
	public ChaptersService() {
		cdao = new ChaptersDAO();
	}
	
	public int save(Chapters chapter) {
		return cdao.save(chapter);
	}
	
	public int delete(int chapter_id) {
		return cdao.delete(chapter_id);
	}
	
	public int update(Chapters chapter) {
		return cdao.modify(chapter);
	}
	
	public Chapters findById(int chapter_id) {
		return cdao.findById(chapter_id);
	}
	
	public PageHelper getPage(int page,int pageSize) {
		return cdao.findPage(page, pageSize);
	}
	
	public List<Catalog> findCatalogById(int bookid) {
		return cdao.findCatalogById(bookid);
	}
	
	public List<Text> findTextById(int bookid, int chapterid) {
		return cdao.findTextById(bookid, chapterid);
	}
}
